import { fetchGet,fetchPatch } from '../utils/http'

/**
 * 判断数据集是否购买
 */
export const checkDatalabIsBuy = (params) => {
    return fetchGet("/data/checkDataIdByCourseId",{
        courseId:params
    })
}
/**
 * 购买获取数据集信息
 */
export const getBuyDatalabInfo = (params) => {
    return fetchGet("/data/getDataByCourseId",{
        courseId:params.courseId,
        dataId:params.dataId
    })
}

/**
 * 教育平台购买Notebook
 */
export const buyNotebook = () => {
    return fetchGet("/resource/courseQuota")
}
 
/**
 * 购买获取机器信息
 */
export const getAllMachine = () => {
    return fetchGet("/resourcePrices/selectAll")
}

/**
 * 续费机器
 */
export const renewalFeeInfo = (params) => {
    return fetchGet("/resource/taskById",{taskId:params})
}

export const seletedMachine = (params) => {
    return fetchGet("/resourcePrices/selectOne",{id:params})
}

/**
 * 服务器价格计算
 */
export const priceCalculate = (params) => {
    return fetchGet("/resource/calculate",{
        resourcePriceId:params.resourcePriceId,
        storage:params.storage,
        time:params.time
    })
}

/**
 * 购买课程，机器资源，数据集(在http.js)
 */


 /**
  * 消费验证码
  */
 export const consumeCode = () => {
     return fetchGet("/checkcode/coin/consume/send")
 }

 /**
  * 确认购买
  */
 export const sureBuy = (params) => {
     return fetchPatch("/coin/order/order/confirm",{
        checkCode:params.checkCode,
        orderNum:params.orderNum,
        userEmail:params.userEmail
     })
 }